package thread;

import java.io.ObjectInputStream;
import java.util.List;

import packageParser.PackageParserForClient;
import protocol.DataPackage;
import frame.ChatFrame;

public class ReceivePackageThread extends Thread{
	private ChatFrame chatRoom;
	private ObjectInputStream reader;
	private List<String> userList;
	private String loginName;
	
	public ReceivePackageThread(ChatFrame chatRoom, ObjectInputStream reader, String loginName) {
		this.chatRoom = chatRoom;
		this.reader = reader;
	}


	@Override
	public void run() {
		try{
			DataPackage pack = (DataPackage)reader.readObject();
			PackageParserForClient.packageParseClientReiceive(pack, userList, chatRoom, loginName);
		}
		catch(Exception e){
			System.out.println("客户端接收包异常...");
		}
		
	}
}
